let express = require('express')
let app = express()

app.get('/', (req, res) => {
  res.send('我是GET请求')
})

app.post('/', (req, res) => {
  res.send('我是POST请求')
})

app.get('/user', (req, res) => {
  let user = {
    name: '车祖鹏',
    age: 23,
    info: '超级无敌大帅哥',
  }
  res.send(JSON.stringify(user))
})

app.get('/userlist', (req, res) => {
  res.send('我是userlist模块请求')
})

let server = app.listen(8088, () => {
  let host = server.address().address
  let port = server.address().port
  console.log("应用实例，访问地址为 http://%s:%s", host, port)
})